#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# @Author  : tester
# @Site    : DONGFANG_HOTEL-10F
# @Software: PyCharm
# @datetime:2020/9/28 19:45
# @license: (C) Copyright 2018-2027, By 金锡科技.
"""

import requests
from logger import getLoggers


log = getLoggers.log


# post请求封装
def http_post(url, params, headers):
    try:
        resp = requests.post(url=url, headers=headers, data=params, timeout=20,
                             stream=True)
        resp.encoding = "utf-8"
        if resp.status_code == 200:
            log.info(f'{url} {resp.status_code} 请求成功, 参数：{params}， 响应结果：{resp.text}')
        else:
            log.info(f'{url} {params} 请求失败, 参数：{resp.status_code}')
    except Exception as e:
        log.error(e)


# get 请求封装
def http_get(url, params):
    try:
        pass
    except Exception as e:
        log.error(e)
